package com.smartalarmclock.Model;

import java.util.Set;

import android.content.Context;

import com.smartalarmclock.Model.Exceptions.DataEntityDoesNotExistException;

public final class SMSMessageFactory implements IDataEntityFactory {

	/**
	 * Constructor
	 * @param message the message string
	 * @return a new SMSMessage instance.
	 */
	public SMSMessage CreateSMSMessage(String message) {
		return new SMSMessage(message);
	}
	
	/**
	 * Queries the DB for a SMSMessage entity with the matching id
	 * @param context the context of the request 
	 * @param id the id to query for
	 * @return the matching SMSMessage instance
	 * @throws DataEntityDoesNotExistException if the matching SMSMessage does not exist
	 */
	public ISMSMessage GetSMSMessageById(Context context, int id) throws DataEntityDoesNotExistException {
		return SMSMessage.GetSMSMessageById(context, id);
	}
	
	/**
	 * Queries the DB for a SMSMessage entity with the matching id
	 * @param context the context of the request 
	 * @param id the id to query for
	 * @return the matching SMSMessage instance, or null if does not exist
	 */
	public ISMSMessage TryGetSMSMessageById(Context context, int id) {
		return SMSMessage.TryGetSMSMessageById(context, id);
	}
	
	/**
	 * Queries the DB for a SMSMessage entity with the matching message string
	 * @param context the context of the request 
	 * @param message the message to query for
	 * @return the matching SMSMessage instance
	 * @throws DataEntityDoesNotExistException if the matching SMSMessage does not exist
	 */
	public ISMSMessage GetSMSMessageByMessageString(Context context, String message) throws DataEntityDoesNotExistException {
		return SMSMessage.GetSMSMessageByMessageString(context, message);
	}
	
	/**
	 * Queries the DB for a SMSMessage entity with the matching message string
	 * @param context the context of the request 
	 * @param message the message to query for
	 * @return the matching SMSMessage instance, or null if does not exist
	 */
	public ISMSMessage TryGetSMSMessageByMessageString(Context context, String message) {
		return SMSMessage.TryGetSMSMessageByMessageString(context, message);
	}
	
	/**
	 * Queries the DB for all SMSMessages
	 * @param context the context of the request 
	 * @return a set of all SMSMessages
	 */
	public static Set<ISMSMessage> GetAllSMSMessages(Context context) {
		return SMSMessage.GetAllSMSMessages(context);
	}
}
